﻿<%@ Control Language="C#" Inherits="System.Web.Mvc.ViewUserControl" %>
<%@ Import Namespace="OAclient.Common" %>

<script type="text/javascript">
    function openNotifyAdd() {
        $.ajax({
            type: "GET",
            url: "/Notify/NotifyAdd",
            success: function(data) {
                addtab('notify-3', '发布公告');
                $("#workarea-notify-3").html(data);
            }
        })
    }

    function notifymodifyshow(msg_id) {
        $.ajax({
            type: "POST",
            url: "/Notify/NotifyModify",
            data: { "msg_id": msg_id },
            success: function(data) {
                addtab('notify-4', '公告');
                $("#workarea-notify-4").html(data);
            }
        })
    }
    
</script>

<div id="notifylistmng">
    <div>
        <input class="btn_style" type="button" value="发布公告" onclick="openNotifyAdd()" style="margin-top: 5px;" />
    </div>
    <div style="margin-top: 5px;">
        <table border="0" width="100%" class="table_style" cellpadding="0" cellspacing="0">
            <thead>
                <tr>
                    <th>
                        标题
                    </th>
                    <th>
                        接收人
                    </th>
                    <th>
                        发送时间
                    </th>
                    <th>
                        消息状态
                    </th>
                    <th>
                    </th>
                </tr>
            </thead>
            <tbody>
                <%
                    System.Data.DataTable dt = ViewData["dt"] as System.Data.DataTable;
                    if (dt == null || dt.Rows.Count == 0)
                    {%>
                <tr>
                    <td colspan="0" style="text-align: center;">
                        当前无数据！
                    </td>
                </tr>
                <%}
                    else
                    {
                        int count = dt.Rows.Count;
                        for (int i = 0; i < count; i++)
                        {
                %>
                <tr>
                    <td>
                        <div class="msg">
                            <%=dt.Rows[i]["标题"]%></div>
                    </td>
                    <td>
                        <%=dt.Rows[i]["接收人"]%>
                    </td>
                    <td>
                        <%=DateTime.Parse(dt.Rows[i]["发送时间"].ToString()).ToString("yyyy-MM-dd HH:mm")%>
                    </td>
                    <td>
                        <%=dt.Rows[i]["已读"].ToString()%>
                    </td>
                    <td>
                        <a class="btn_detail" onclick="notifymodifyshow(<%= dt.Rows[i]["编码"]%>)">查看</a>
                    </td>
                </tr>
                <%
                    }
                    }%>
            </tbody>
        </table>
    </div>
    <div id="pageLink">
        <%var pageInfo = ViewData["pageInfo"] as PagingInfo; %>
        <%if (pageInfo != null)
          { %>
        <%=Ajax.PageLinks(pageInfo, index => Url.Action("NotifyListMng", new { page = index }), new AjaxOptions { UpdateTargetId = "workarea-notify-2" })%>
        <%} %>
    </div>
</div>
